# encoding=UTF-8
import time

class INFO(object):
    def __init__(self, request):
        self.__request = request

    def checkPostEmpty(self, *par):
        if self.__request.method != 'POST':
            raise Exception('must be POST')
        for i in par:
            if self.__request.POST.get(i) == None:
                # print("GET: %s -> %s"% (i,self.__request.GET.get(i)))
                raise Exception('%s 不能为空' % i)
            else:
                # print("POST: %s -> %s"% (i,self.__request.POST.get(i)))
                pass
    #获取时间秒数
    def tick(self):
        return int(time.time())

    def __getattr__(self, item):
        if self.__request.POST.get(item) == None:
            return ""
        return self.__request.POST.get(item)
